package exttable.dbclasses;

import exttable.formgenerator.StaticMethods;
import exttable.view.ILocalsation;
import utils.Localisation;

import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.Map;

/**
 * Created by IntelliJ IDEA.
 * User: ADMIN
 * Date: 02.02.2011
 * Time: 10:00:45
 * To change this template use File | Settings | File Templates.
 */
public class DbTable implements ILocalsation {
    String dataBaseName;
    String tableName;
    String keyFieldName;
    String keyFieldValue;
    Map<String,String> mapValuesFields=new HashMap<String,String>();
    LinkedList<String> columnNamesLinkedList;
    String testTypeId;
    String nameRu;
    String nameEn;
    String nameKz;
    Map<String,DbTableField> mapTableFields=new HashMap<String,DbTableField>();

    public String getDataBaseName() {
        return dataBaseName;
    }

    public void setDataBaseName(String dataBaseName) {
        this.dataBaseName = dataBaseName;
    }

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }

    public String getKeyFieldName() {
        return keyFieldName;
    }

    public void setKeyFieldName(String keyFieldName) {
        this.keyFieldName = keyFieldName;
    }

    public String getKeyFieldValue() {
        return keyFieldValue;
    }

    public void setKeyFieldValue(String keyFieldValue) {
        this.keyFieldValue = keyFieldValue;
    }

    public Map<String, String> getMapValuesFields() {
        return mapValuesFields;
    }

    public void setMapValuesFields(Map<String, String> mapValuesFields) {
        this.mapValuesFields = mapValuesFields;
    }

    public LinkedList<String> getColumnNamesLinkedList() {
        return columnNamesLinkedList;
    }

    public void setColumnNamesLinkedList(LinkedList<String> columnNamesLinkedList) {
        this.columnNamesLinkedList = columnNamesLinkedList;
    }

    public String getTestTypeId() {
        return testTypeId;
    }

    public void setTestTypeId(String testTypeId) {
        this.testTypeId = testTypeId;
    }

    public String getNameRu() {
        return nameRu;
    }

    public void setNameRu(String nameRu) {
        this.nameRu = nameRu;
    }

    public String getNameEn() {
        return nameEn;
    }

    public void setNameEn(String nameEn) {
        this.nameEn = nameEn;
    }

    public String getNameKz() {
        return nameKz;
    }

    public void setNameKz(String nameKz) {
        this.nameKz = nameKz;
    }

    public Map<String, DbTableField> getMapTableFields() {
        return mapTableFields;
    }

    public void setMapTableFields(Map<String, DbTableField> mapTableFields) {
        this.mapTableFields = mapTableFields;
    }

    public DbTable(String dataBaseName, String tableName, String keyFieldValue) {
        this.dataBaseName=dataBaseName;
        this.tableName = tableName;
        this.keyFieldName= StaticMethods.getIdField(dataBaseName,tableName);
        this.keyFieldValue=keyFieldValue;
        this.columnNamesLinkedList=StaticMethods.getColumnNamesOfTable(dataBaseName,tableName);
    }

    @Override
    public String toString() {
        return Localisation.getMsg(this);
    }
}
